package featuremodel.method;

import skyblue.Method;
import skyblue.SkyBlueDef;
import skyblue.Variable;
import featuremodel.FeatureRep;

public class OrMethodChild extends Method {
	private Variable parent;
	private Variable child;

	public OrMethodChild(Variable parent, Variable child) {
		this.parent = parent;
		this.child = child;

		getOutputs().add(parent);
		getOutputs().add(child);

	}

	public void setTobeMethodType() {

		parent.setTobemethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		child.setTobemethodtype(SkyBlueDef.METHOD_TYPE_BIND);

	}

	public void clearTobeMethodType() {
		parent.setTobemethodtype(null);
		child.setTobemethodtype(null);
	}

	public void setTobeMethodType2() {
		parent.setTobeMethodType2(SkyBlueDef.METHOD_TYPE_BIND);
		child.setTobeMethodType2(SkyBlueDef.METHOD_TYPE_BIND);

	}

	public void clearTobeMethodType2() {
		parent.setTobeMethodType2(null);
		child.setTobeMethodType2(null);
	}

	public void execute() {

		FeatureRep fp = (FeatureRep) parent.getValue().getValuerep();
		fp.setBindState(SkyBlueDef.VARIABLE_BIND);
		this.parent.setMethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		parent.setTobemethodtype(null);

		fp = (FeatureRep) child.getValue().getValuerep();
		fp.setBindState(SkyBlueDef.VARIABLE_BIND);
		this.child.setMethodtype(SkyBlueDef.METHOD_TYPE_BIND);
		parent.setTobemethodtype(null);

	}

	public Variable getParent() {
		return parent;
	}

	public void setParent(Variable parent) {
		this.parent = parent;
	}

	public Variable getChild() {
		return child;
	}

	public void setChild(Variable child) {
		this.child = child;
	}

}
